package com.example.mapper.vomapper;

import com.example.pojo.vo.*;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/*
 *  @author 雨安
 *  类名： TestMapper
 *  创建时间：2024/3/12
 */
@Repository
public interface TestMapper {

    //企业表
    @Select("select DISTINCT hous_name ,addr ,b.charger_name ,\n" +
            "       economic_type_name ,legal_id_num ,b.lice_no ,\n" +
            "           operate_rahge_hame ,contacter ,lssu_date\n" +
            "    from businessoperation b\n" +
            "    left join householdinformation h\n" +
            "    on b.lice_no = h.lice_no ORDER BY lssu_date DESC")
    List<FirmTest> selectAllList();

    //车辆基础信息
    @Select("select DISTINCT plate_Num, SUBSTR(r.plate_Num, 1, 7) car_no ,SUBSTR(r.plate_Num,8,10) car_no_color,\n" +
            "yingyunztbm ,r.vehi_type ,r.busi_scope ,rt.vin ,h.jingyingfwbm ,\n" +
            "h.xingshizscdjrq ,h.zongzhiliang ,daolyyszzh ,\n" +
            "fadongjhim ,r.hous_name\n" +
            "from roadtransport r\n" +
            " left join roadtransportvehicles rt on SUBSTR(r.plate_Num, 1, 7) = rt.vehicle_no\n" +
            " left join heavygeneralcargo h on SUBSTR(r.plate_Num, 1, 7) = chepaihm where is_flag = 1")
    List<CarTest> selectCarList();


    //年审表
    @Select("select r.plate_Num ,h.daoluyszh ,h.fazhengrq ,\n" +
            "       r.card_end_date ,h.nianshenyxjzq ,h.fujian ,r.card_id\n" +
            "from heavygeneralcargo h\n" +
            "         left join roadtransport r on chepaihm = substr(plate_Num,1,7)\n" +
            "where is_flag = 1")
    List<NianShenTest> selectNianSheng();

    //行驶证
    @Select("select r.plate_Num ,h.xingshizscdjrq ,h.xingshiznsyxrq ,\n" +
            "       cheliangxszh ,\n" +
            "       h.yujibfrq ,h.fujian ,r.card_id\n" +
            "from heavygeneralcargo h\n" +
            "         left join roadtransport r on chepaihm = substr(plate_Num,1,7)\n" +
            "where is_flag = 1")
    List<XingShiZhengTest> selectXingShiZheng();


    @Select("select r.plate_Num ,h.daoluyszh ,h.fazhengrq ,\n" +
            "       h.nianshenyxjzq ,h.fujian ,r.card_id\n" +
            "from heavygeneralcargo h\n" +
            "         left join roadtransport r on h.chepaihm = substr(r.plate_Num,1,7)\n" +
            "where r.is_flag = 1")
    List<DaoLuYunShuTest> selectDaoLuYunShuZheng();


    @Select("select plate_Num,engine_discharge ,engine_power ,\n" +
            "vehicle_color ,fuel_type_Code ,bianhao ,\n" +
            "vehi_length ,vehi_width ,vehi_high,card_id\n" +
            "from roadtransport r\n" +
            "left join roadtransportvehicles rt on substr(plate_Num,1,7) = rt.vehicle_no\n" +
            "left join heavygeneralcargo h on substr(plate_Num,1,7) = h.chepaihm\n" +
            "where is_flag = 1")
    List<CheLiangJiShuTest> selectCheLiangJiShuDengJi();

}
